#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int a, b;
int c[20], num;
int dp[2][2][10][20];
void init(int n) {
  num = 0;
  while (n) {
    c[++num] = n % 10;
    n /= 10;
  }
  if (!num) c[++num] = 0;
}
int dfs(bool zero, bool limit, int pre, int s) {
  if (s == 0) return 1;
  if (dp[zero][limit][pre][s] != -1) return dp[zero][limit][pre][s];
  int& res = dp[zero][limit][pre][s];
  res = 0;
  int imx = limit ? c[s] : 9;
  rep(i, 0, imx) {
    if (!zero && abs(pre - i) < 2) continue;
    int czero = zero && i == 0;
    int climit = limit && i == imx;
    res += dfs(czero, climit, i, s - 1);
  }
  return res;
}
int solve() {
  int res = 0;
  init(b);
  memset(dp, -1, sizeof(dp));
  res += dfs(1, 1, 0, num);
  init(a - 1);
  memset(dp, -1, sizeof(dp));
  res -= dfs(1, 1, 0, num);
  return res;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> a >> b;
  cout << solve();
  return 0;
}